#include <iostream>
#include <cstring>
#include <queue>
#include <string>
#include <algorithm>
#include <string.h>
#include <map>
#include <set>

using namespace std;
int n;

struct dict
{
    bool operator()(const string &str1, const string &str2) const
    {
        return str1.length() < str2.length() || (str1.length() == str2.length() && str1 < str2);
    }
};

map<string, int, dict> mp;

int main()
{
    while (cin >> n)
    {
        int cnt = 0;

        mp.clear();
        for (int i = 1; i <= n; i++)
        {
            string temp;
            cin >> temp;
            auto idx = temp.find(".mp4");
            if (idx != string::npos)
            {
                mp[temp]++;
            }
        }
        for (auto it = mp.begin(); it != mp.end(); it++)
        {

            cnt++;
            cout << it->first << endl;
            if (cnt >= 50)
            {

                break;
            }
        }
    }
    return 0;
}